Imports System.ComponentModel

<DataObject(True)> _
Public Class CategoryODS

#Region "For Category Manager"

    <DataObjectMethod(DataObjectMethodType.Delete, True)> _
    Public Shared Function DeleteCategory(ByVal original_ID As Integer, ByVal original_Name As String) As Boolean
        'Throw New Exception("The value passed to the delete method is " & original_ID & " | " & original_Name)
        Return QuestionnaireODS.Provider.DeleteCategory(original_ID, original_Name)
    End Function

    <DataObjectMethod(DataObjectMethodType.Insert, True)> _
    Public Shared Function CreateCategory(ByVal name As String, ByVal desc As String) As Category
        Return QuestionnaireODS.Provider.CreateCategory(name, desc)
    End Function

    <DataObjectMethod(DataObjectMethodType.Select, True)> _
    Public Shared Function GetCategories() As DataView
        Return QuestionnaireODS.Provider.GetCategories
    End Function

    Public Shared Function GetCategory(ByVal id As Integer) As String
        Return QuestionnaireODS.Provider.GetCategory(id)
    End Function

    <DataObjectMethod(DataObjectMethodType.Update, True)> _
    Public Shared Sub UpdateCategory(ByVal id As Integer, ByVal name As String, ByVal description As String)
        Dim cat As New Category(id, name, description, 0)
        QuestionnaireODS.Provider.UpdateCategory(cat)
    End Sub

#End Region

End Class
